home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1998 January / PC Answers Issue 49 Cover CD January 1998.iso / Apps / Director / DATA.Z / Learning Director.dcr / Internal_3_SS_LessonInit.ls < prev    next >
Encoding:
Text File  |  1997-05-10  |  3.4 KB  |  79 lines

  1. on exitFrame
  2.   SG(#gPaused, 0)
  3.   set labelName to the frameLabel
  4.   if labelName = 0 then
  5.     put "ERROR: Required Label missing from current frame"
  6.     halt()
  7.   end if
  8.   set pos to offset("-", labelName)
  9.   set lessonNum to value(chars(labelName, 2, pos - 1))
  10.   set lessonPrefix to "L" & string(lessonNum) & "-"
  11.   if not voidp(GG(#gLessonNum)) then
  12.     if GG(#gLessonNum) = lessonNum then
  13.       selectLine(GG(#gActiveScroller), 1, 1)
  14.       return 
  15.     end if
  16.   end if
  17.   SG(#gLessonNum, lessonNum)
  18.   SG(#gStepNum, 0)
  19.   SG(#gLessonPrefix, lessonPrefix)
  20.   set the text of member "CurrentLessonSteps#field" to EMPTY
  21.   set autoChannels to GetAutoChannels()
  22.   puppetSprite(getaProp(autoChannels, #lessonRTF), 1)
  23.   puppetSprite(getaProp(autoChannels, #lessonShadowRTF), 1)
  24.   puppetSprite(getaProp(autoChannels, #listTextFIELD), 1)
  25.   puppetSprite(getaProp(autoChannels, #vscrollBITMAP), 1)
  26.   puppetSprite(getaProp(autoChannels, #thumbBITMAP), 1)
  27.   puppetSprite(getaProp(autoChannels, #upScrollBITMAP), 1)
  28.   puppetSprite(getaProp(autoChannels, #downScrollBITMAP), 1)
  29.   set channelNum to getaProp(autoChannels, #lessonRTF)
  30.   puppetSprite(channelNum, 1)
  31.   set the castNum of sprite channelNum to the number of member (lessonPrefix & "Title#richText")
  32.   set channelNum to getaProp(autoChannels, #lessonShadowRTF)
  33.   puppetSprite(channelNum, 1)
  34.   set the castNum of sprite channelNum to the number of member (lessonPrefix & "TitleShadow#richText")
  35.   set stepsText to the text of member (lessonPrefix & "Steps#field")
  36.   set stepsText to stripWhiteSpace(stepsText, #end)
  37.   set the text of member "LineBreakTester#field" to EMPTY
  38.   set lineWrapsList to []
  39.   set lineHeight to the textHeight of member "LineBreakTester#field"
  40.   set linesSoFar to EMPTY
  41.   set memberHeight to 0
  42.   set scrollerData to [:]
  43.   set listCells to []
  44.   set numLines to the number of lines in stepsText
  45.   repeat with lineNum = 1 to numLines
  46.     set thisLine to line lineNum of stepsText
  47.     append(listCells, thisLine)
  48.     if lineNum > 1 then
  49.       set thisLine to RETURN & thisLine
  50.     end if
  51.     set the text of member "LineBreakTester#field" to linesSoFar & thisLine
  52.     set linesSoFar to linesSoFar & thisLine
  53.     set newMemberHeight to the height of member "LineBreakTester#field"
  54.     append(lineWrapsList, (newMemberHeight - memberHeight) / lineHeight)
  55.     set memberHeight to newMemberHeight
  56.   end repeat
  57.   addProp(scrollerData, getaProp(autoChannels, #listTextFIELD), listCells)
  58.   SG(#gLineWrapList, lineWrapsList)
  59.   SG(#gActiveScroller, birth(script "PS_ListScroller", getaProp(autoChannels, #vscrollBITMAP), getaProp(autoChannels, #thumbBITMAP), getaProp(autoChannels, #upScrollBITMAP), getaProp(autoChannels, #downScrollBITMAP), scrollerData))
  60.   selectLine(GG(#gActiveScroller), 1, 1)
  61.   myPreLoad(lessonNum)
  62. end
  63.  
  64. on myPreLoad thisLesson
  65.   global gFirstList, gLastList
  66.   cursor(4)
  67.   set previousLesson to thisLesson - 1
  68.   if previousLesson < 0 then
  69.     set previousLesson to 0
  70.   end if
  71.   set previousFirstCast to getaProp(gFirstList, previousLesson)
  72.   set previousLastCast to getaProp(gLastList, previousLesson)
  73.   unloadMember(member previousFirstCast of castLib "VoiceOvers and Sounds", member previousLastCast of castLib "VoiceOvers and Sounds")
  74.   set firstCast to getaProp(gFirstList, thisLesson)
  75.   set lastCast to getaProp(gLastList, thisLesson)
  76.   preloadMember(member firstCast of castLib "VoiceOvers and Sounds", member lastCast of castLib "VoiceOvers and Sounds")
  77.   cursor(0)
  78. end
  79.